import request from '@/config/axios'
import type { Dayjs } from 'dayjs';

/** 知识图谱信息 */
export interface KnowledgeGraph {
          id: number; // ID
          code: string; // 知识编号
          subject: string; // 学科
          parentId: number; // 父ID
          level?: number; // 层级深度
          sortOrder: number; // 同级排序
          nodeType: string; // 节点类型
          title: string; // 节点标题
          content: string; // 节点详细内容
          style: string; // 存储样式信息
          metadata: string; // 其他扩展信息
  }

// 知识图谱 API
export const KnowledgeGraphApi = {
  // 查询知识图谱分页
  getKnowledgeGraphPage: async (params: any) => {
    return await request.get({ url: `/exam/knowledge-graph/page`, params })
  },

  // 查询知识图谱详情
  getKnowledgeGraph: async (id: number) => {
    return await request.get({ url: `/exam/knowledge-graph/get?id=` + id })
  },

  // 新增知识图谱
  createKnowledgeGraph: async (data: KnowledgeGraph) => {
    return await request.post({ url: `/exam/knowledge-graph/create`, data })
  },

  // 修改知识图谱
  updateKnowledgeGraph: async (data: KnowledgeGraph) => {
    return await request.put({ url: `/exam/knowledge-graph/update`, data })
  },

  // 删除知识图谱
  deleteKnowledgeGraph: async (id: number) => {
    return await request.delete({ url: `/exam/knowledge-graph/delete?id=` + id })
  },

  /** 批量删除知识图谱 */
  deleteKnowledgeGraphList: async (ids: number[]) => {
    return await request.delete({ url: `/exam/knowledge-graph/delete-list?ids=${ids.join(',')}` })
  },

  // 导出知识图谱 Excel
  exportKnowledgeGraph: async (params) => {
    return await request.download({ url: `/exam/knowledge-graph/export-excel`, params })
  },
}